﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_ACEIndex.cshtml";
}
@*<script src="~/Content/knockout/knockout-latest.js"></script>*@
@this.Partial("Index-js")
<script>
@*    var departmentList = @this.Raw(this.ViewBag.DepartmentListString)*@
</script>
@*    @this.Partial("_MutipleSearch")*@
<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$ace.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" data-bind="click:Edit,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" data-bind="click:Delete,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" data-bind="click:Add"><i class="fa fa-plus"></i>添加</button>
            <button class="btn btn-primary" data-bind="click:Detail,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>详情</button>  
        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="名称/编号" style="width: 200px;" data-bind="value:SearchModel().keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" data-bind="click:Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>


<div class="table-responsive">
    <table class="table table-hover" data-bind="with:DataTable">
        <thead>
            <tr>
                <th style="width:20px;"></th>
                <th>ID</th>
                <th>组名</th>
                <th>编号</th>
            </tr>
        </thead>
        <tbody data-bind="foreach:Models">
            <tr data-bind="click:$parent.SelectRow">
                <td data-bind="text:$parent.GetOrdinal($index())"></td>
                <td data-bind="text:id"></td>
                <td data-bind="text:groupname"></td>
                <td data-bind="text:groupcode"></td>
            </tr>
        </tbody>
    @this.Partial("_tfoot")
    </table>
</div>


@using (Html.Dialog())
{

    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div class="alert alert-danger" style="text-align: left; margin-bottom: 10px;">
                <i class="fa fa-warning alert-dismissible" style="position: relative; top: 1px; font-size: 15px; padding-right: 5px;"></i>
                分组编号必须唯一且为2的倍数！
            </div>
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">组名<span style="color:red;">*</span></td>
                        <td class="formValue">
                            <input id="groupname" name="groupname" type="text" class="form-control required" placeholder="请输入组名" data-bind="value:Model().groupname" />
                        </td>
                    </tr>

                    <tr>
                        <td class="formTitle">编码<span style="color:red;">*</span></td>
                        <td class="formValue">
                            <input id="groupcode" name="groupcode" type="text" class="form-control required" placeholder="请输入编码" data-bind="value:Model().groupcode" />
                        </td>
                    </tr>
     
                </table>
            </div>
        </div>
    </form>

}

@using (Html.Dialog("DetailDialog", "DetailDialog", 800))
{
    <form id="DetailForm">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">组名</td>
                        <td class="formValue">
                           <label class="form-control" data-bind="text:Model().groupname"></label>
                        </td>
                    </tr>
                   <tr>
                        <td class="formTitle">编码</td>
                        <td class="formValue">
                             <label class="form-control" data-bind="text:Model().groupcode"></label>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
}
